package com.guojiganzhe.oss.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * minio配置管理
 * @author: guojiganzhe
 * @date: 2022/7/27 14:05
 * @description:
 */
@Configuration
public class MinioConfig {
    /**
     * minio服务地址
     */
    @Value("${minio.url}")
    private String url;
    /**
     * minio用户名
     */
    @Value("${minio.accessKey}")
    private String accessKey;
    /**
     * minio密码
     */
    @Value("${minio.secretKey}")
    private String secretKey;
    /**
     * 创建MinioClient对象
     * @return
     */
    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(url)
                .credentials(accessKey, secretKey)
                .build();
    }


}
